/*******************************************************************************
 * This code is totally free to edit and be distributed
 * Author: José Manuel Portero García (jmporterog@gmail.com)
 ******************************************************************************/
package gazpachito.examples.dozer.facade;

import java.io.Serializable;
import java.util.Set;

/**
 * @author jmporterog
 *
 */
public class ParentBO implements Serializable {

	private static final long serialVersionUID = 440303735656145958L;

	protected Integer businessId;
	
	protected String name;
	
	protected Set<ChildBO> childBOs;

	public Integer getBusinessId() {
		return businessId;
	}

	public void setBusinessId(Integer businessId) {
		this.businessId = businessId;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Set<ChildBO> getChildBOs() {
		return childBOs;
	}

	public void setChildBOs(Set<ChildBO> childBOs) {
		this.childBOs = childBOs;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((businessId == null) ? 0 : businessId.hashCode());
		result = prime * result
				+ ((childBOs == null) ? 0 : childBOs.hashCode());
		result = prime * result + ((name == null) ? 0 : name.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		ParentBO other = (ParentBO) obj;
		if (businessId == null) {
			if (other.businessId != null)
				return false;
		} else if (!businessId.equals(other.businessId))
			return false;
		if (childBOs == null) {
			if (other.childBOs != null)
				return false;
		} else if (!childBOs.equals(other.childBOs))
			return false;
		if (name == null) {
			if (other.name != null)
				return false;
		} else if (!name.equals(other.name))
			return false;
		return true;
	}
}
